package com.vitaf.cash.app.ui.adapter

import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.vitaf.cash.app.VitafCashApplication
import com.vitaf.cash.app.R
import com.vitaf.cash.app.utils.extensions.getStringRes
import com.vitaf.cash.lib.adapter.VitafRecyclerViewAdapter
import com.vitaf.cash.lib.adapter.VitafViewHolderHelper
import org.json.JSONObject

/**
 * GombeCredit
 * @Author wwdeng
 * @CreateTime: 2025/3/6 13:33
 * @Annotation：客服列表
 */
class VitafCustomerApt(recyclerView: RecyclerView?) : VitafRecyclerViewAdapter<JSONObject>(recyclerView, R.layout.vitaf_dlog_customer_item) {
    override fun setItemChildListener(helper: VitafViewHolderHelper, viewType: Int) {
        helper.setItemChildClickListener(R.id.textCustomerFun) //拨号、复制
    }

    override fun fillData(helper: VitafViewHolderHelper, position: Int, model: JSONObject) {
        helper.setText(R.id.textCustomerValue,model.optString("value"))
        when(model.optString("type")){
            "MOBILE" -> {//电话
                helper.setText(R.id.textCustomerTitle, mContext.getStringRes(R.string.gombe_credit_string_customer_dialog_mobile_title))
                helper.setText(R.id.textCustomerFun, mContext.getStringRes(R.string.gombe_credit_string_customer_dialog_mobile_dial))
                helper.setVisibility(R.id.textCustomerFun, View.VISIBLE)
            }
            else -> {//邮箱
                helper.setText(R.id.textCustomerTitle, mContext.getStringRes(R.string.gombe_credit_string_customer_dialog_email_title))
                helper.setText(R.id.textCustomerFun, mContext.getStringRes(R.string.gombe_credit_string_customer_dialog_email_copy))
                helper.setVisibility(R.id.textCustomerFun, View.GONE)
            }
        }
    }
}